﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace AutoChess
{
    public class HeroListItem : MonoBehaviour
    {
        public Transform starRoot;
        public GameObject starObj;
        public TextureKit icon;

        public void InitHero(HeroData data)
        {
            var chessTable = Table.Blo.AutoChessBlo.GetChessTable(data.chessId);
            var heroTable = Table.Blo.TableHeroBlo.GetTableHero(chessTable.heroId);
            icon.TextureName = heroTable.heroPaint;

            starRoot.DestroyChildren();
            for (int i = 0; i < chessTable.star; i++)
            {
                var star = Instantiate<GameObject>(starObj, starRoot);
                star.SetActive(true);
            }
        }
    }
}
